<template>
  <div class="app">
    <button @click="getStudent">点我获取学生信息</button>
    <button @click="getCar">点我获取汽车信息</button>
    <button @click="getNews">点我获取头条新闻</button>
  </div>
</template>

<script>
  import axios from 'axios'
  export default {
    name:'App',
    methods: {
      getStudent(){
        axios.get('http://localhost:8080/api1/students').then(
          response => {console.log('成功了',response.data)},
          error => {console.log('失败了',error.message)}
        )
      },
      getCar(){
        axios.get('http://localhost:8080/api2/cars').then(
          response => {console.log('成功了',response.data)},
          error => {console.log('失败了',error.message)}
        )
      },
      getNews(){
        axios.get('http://localhost:8080/api3/hot-event/hot-board/?origin=toutiao_pc').then(
          response => {console.log('成功了',response.data)},
          error => {console.log('失败了',error.message)}
        )
      }
    },
  }
</script>

<style scoped>
  .app {
    background-color: skyblue;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 0 10px black;
  }
  button{
    font-size: 30px;
  }
</style>